#ifndef TRAM_H
#define TRAM_H

#include <QGraphicsItem>
#include "types.h"
class Rails;
class QPointF;
class QRoundabout;

class Tram :  public QObject, public QGraphicsItem
{
    Q_OBJECT
    Q_INTERFACES(QGraphicsItem)
public:
    Tram(Rails *r, QRoundabout *qr, qreal dist);

    QRectF boundingRect() const; //funkcja wirtualna. Całe rysowanie wenątrz tego prostokąta
    QPainterPath shape() const;
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
               QWidget *widget); //aktualne rysowanie. Także wirtualna.

signals:

public slots:

protected:
    void advance(int step);
    void mousePressEvent ( QGraphicsSceneMouseEvent * event );

private:
    Rails *_rails;
    QPainterPath *_tram;
    QRoundabout *_qr;
    QColor _color;
    qreal _speed;
    qreal _angle;
    Manouver _state;

    void turn();

};

#endif // TRAM_H
